﻿' Note: For instructions on enabling IIS6 or IIS7 classic mode, 
' visit http://go.microsoft.com/?LinkId=9394802
Imports StructureMap
Namespace myBookmarks.Web
    Public Class MvcApplication
        Inherits System.Web.HttpApplication

        Shared Sub RegisterRoutes(ByVal routes As RouteCollection)

            routes.IgnoreRoute("{file}.txt")
            routes.IgnoreRoute("{file}.xml")
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
            routes.IgnoreRoute("elmah.axd")
            routes.IgnoreRoute("{*favicon}", New With {.favicon = "(.*/)?favicon.([iI][cC][oO]|[gG][iI][fF])(/.*)?"})

            routes.MapRoute("Logout", "Logout", New With {.controller = "Account", .action = "Logout"})
            routes.MapRoute("Register", "Register", New With {.controller = "Account", .action = "Register"})
            routes.MapRoute("Login", "Login", New With {.controller = "Account", .action = "Login"})
            routes.MapRoute("ResetPassword", "ResetPassword", New With {.controller = "Account", .action = "ResetPassword"})
            routes.MapRoute("LostPassword", "LostPassword", New With {.controller = "Account", .action = "LostPassword"})

            routes.MapRoute("EmailBookmark", "EmailBookmark", New With {.controller = "Bookmark", .action = "EmailBookmark"})
            routes.MapRoute("UserAccount", "UserAccount", New With {.controller = "Bookmark", .action = "UserAccount"})
            routes.MapRoute("Search", "Search", New With {.controller = "Bookmark", .action = "Search"})
            routes.MapRoute("DeleteLabel", "DeleteLabel/{id}", New With {.controller = "Bookmark", .action = "DeleteLabel", .id = ""})
            routes.MapRoute("DeleteAll", "DeleteAll", New With {.controller = "Bookmark", .action = "DeleteAll"})
            routes.MapRoute("DeleteBookmark", "DeleteBookmark/{id}", New With {.controller = "Bookmark", .action = "DeleteBookmark", .id = ""})
            routes.MapRoute("EditBookmark", "EditBookmark/{id}", New With {.controller = "Bookmark", .action = "EditBookmark", .id = ""})
            routes.MapRoute("ExportBookmark", "ExportBookmark", New With {.controller = "Bookmark", .action = "ExportBookmark"})
            routes.MapRoute("ManageLabels", "ManageLabels", New With {.controller = "Bookmark", .action = "ManageLabels"})
            routes.MapRoute("GetLabelMenus", "GetLabelMenus", New With {.controller = "Bookmark", .action = "GetLabelMenus"})
            routes.MapRoute("AddBookmark", "AddBookmark", New With {.controller = "Bookmark", .action = "AddBookmark"})
            routes.MapRoute("Default", "{controller}/{action}", New With {.controller = "Bookmark", .action = "Index"})


        End Sub

        Sub Application_Start()
            RegisterRoutes(RouteTable.Routes)
            IoCContainer.Configure()
            ControllerBuilder.Current.SetControllerFactory(New StructureMapControllerFactory())
        End Sub
    End Class
End Namespace
